<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\facade\Route;
use app\middleware\backend\AuthMiddleware as BAuthMiddleware;

/**
 * 后台路由组
 * 废弃api验证,简化路由
 * 方便简写,采用驼峰🤐🤐🤐
 */

/**
 * 域名组
 */
// Route::domain(config('domain.backend'), function () {
Route::group('', function () {
    /**
     * 根目录重定向
     */
    Route::get('/', function () {
        return redirect('b/site/view.html');
    });

    /**
     * 无权限验证
     */
    Route::group('b', function () {

        /*
         * 网站
         */
        Route::rule('site/view', 'backend.site.SiteController/view');
        Route::rule('site/login', 'backend.site.SiteController/login');
        Route::rule('site/logout', 'backend.site.SiteController/logout');

        /*
         * 测试
         */
        Route::rule('test/:action', 'backend.TestController/:action');
    });

    /**
     * 存在验证
     */
    Route::group('b', function () {

        /*
        |--------------------------------------------------------------------------
        | 平台端
        |--------------------------------------------------------------------------
        |
        */

        /*
         * 工作台
         */
        Route::rule('home/:action', 'backend.home.HomeController/:action');

        /*
         * 财务管理
         */
        // 专家余额提现
        Route::rule('fb/:action', 'backend.finance.BalanceController/:action');
        // 元心币提现
        Route::rule('fc/:action', 'backend.finance.CoinController/:action');

        /*
         * 订单管理
         */
        Route::rule('om/:action', 'backend.order.MultiController/:action');
        Route::rule('oc/:action', 'backend.order.ConsultController/:action');

        /*
         * 用户管理
         */
        Route::rule('user/:action', 'backend.user.UserController/:action');

        /*
         * 客服管理
         */
        // Route::rule('customer/:action', 'backend.system.CustomerController/:action');

        /*
         * 专家管理
         */
        Route::rule('expert/:action', 'backend.user.ExpertController/:action');
        // 设置项目
        Route::rule('expertI/:action', 'backend.user.ExpertItemController/:action');

        /*
         * 量表管理
         */
        // 量表分类
        Route::rule('sc/:action', 'backend.scale.CategoryController/:action');
        // 多元智能题型
        Route::rule('multi/:action', 'backend.scale.MultiController/:action');
        Route::rule('multiT/:action', 'backend.scale.MultiTypeController/:action');
        Route::rule('multiTo/:action', 'backend.scale.MultiTopicController/:action');
        Route::rule('multiE/:action', 'backend.scale.MultiExpertController/:action');

        /*
         * 课程管理
         */
        // 课程分类
        Route::rule('courseC/:action', 'backend.course.CategoryController/:action');
        // 课程内容
        Route::rule('course/:action', 'backend.course.CourseController/:action');
        // 课程章
        Route::rule('chapter/:action', 'backend.course.ChapterController/:action');
        // 课程节
        Route::rule('section/:action', 'backend.course.SectionController/:action');
        // 视频分类
        Route::rule('vc/:action', 'backend.course.VCController/:action');
        // 视频内容
        Route::rule('video/:action', 'backend.course.VideoController/:action');


        /*
         * 维护管理
         */
        // 广告位维护
        Route::rule('banner/:action', 'backend.maintain.BannerController/:action');
        // 公告维护
        Route::rule('placard/:action', 'backend.maintain.PlacardController/:action');
        // 咨询师简介
        Route::rule('counselor/:action', 'backend.maintain.CounselorController/:action');
        Route::rule('counselorT/:action', 'backend.maintain.CtController/:action');
        Route::rule('counselorE/:action', 'backend.maintain.CeController/:action');
        Route::rule('counselorEx/:action', 'backend.maintain.CexController/:action');
        Route::rule('counselorC/:action', 'backend.maintain.CcController/:action');
        Route::rule('counselorS/:action', 'backend.maintain.CsController/:action');
        Route::rule('counselorSe/:action', 'backend.maintain.CseController/:action');
        Route::rule('counselorL/:action', 'backend.maintain.ClController/:action');
        Route::rule('counselorSt/:action', 'backend.maintain.CstController/:action');
        Route::rule('counselorQ/:action', 'backend.maintain.CqController/:action');
        // 信息维护
        Route::rule('info/:action', 'backend.maintain.InfoController/:action');

        /*
         * 系统管理
         */
        // 角色
        Route::rule('role/:action', 'backend.system.RoleController/:action');
        // 菜单
        Route::rule('menu/:action', 'backend.system.MenuController/:action');
        // 权限
        Route::rule('permits/:action', 'backend.system.PermissionsController/:action');
        // 参数配置
        Route::rule('params/:action', 'backend.system.ParamsController/:action');
        // 员工
        Route::rule('admin/:action', 'backend.system.AdminController/:action');

        /*
         * 中国地区
         */
        Route::rule('region/:action', 'backend.region.RegionController/:action');

        /*
         * 统计通用
         */
        Route::any('statistic/:action', 'backend.home.StatisticsController/:action');

        /*
         * 其他
         */
        Route::rule('site/upload', 'backend.site.SiteController/upload');

        /*
        |--------------------------------------------------------------------------
        | 客服端
        |--------------------------------------------------------------------------
        |
        */
        // 客服
        Route::any('customer/:action', 'backend.system.CustomerController/:action');
        // 用户聊天
        Route::any('chat/:action', 'backend.user.ChatController/:action');

        // test
        Route::any('test/:action', 'backend.TestController/:action');
    })->pattern(['id' => '\d+', 'ids' => '[1-9]\d*(,[1-9]\d*)*'])->middleware([
        BAuthMiddleware::class,
    ]);
})->middleware([
    'cors'
]);

